﻿// MIT License
// 开源地址：https://gitee.com/co1024/AbcMvc
// Copyright (c) 2021-2023 1024
// Abc.Mvc=Furion+EF+SqlSugar+Pear layui admin.

namespace Abc.Application.HtAdminServices;

/// <summary>
/// ServiceMapper
/// </summary>
public class HtMenuMapperInput : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        // 示例
        //config.ForType<__EFMigrationsHistory,__EFMigrationsHistoryDto>()
        //.Map(dest => dest.MigrationId, src => src.MigrationId)//
        //.Map(dest => dest.ProductVersion, src => src.ProductVersion)//
        //;

        // Description 菜单表
        config.ForType<HtMenuInput, SysMenu>()
        //.Map(dest => dest.Id, src => src.Id)// ID
        .Map(dest => dest.Code, src => src.Code != null ? src.Code.Trim() : "")// 菜单ID
        .Map(dest => dest.PCode, src => src.PCode != null ? src.PCode.Trim() : "")// 父Id
        .Map(dest => dest.Area, src => src.Area != null ? src.Area.Trim() : "")// 区域
        .Map(dest => dest.Name, src => src.Name != null ? src.Name.Trim() : "")// 菜单名称
        .Map(dest => dest.Url, src => src.Url != null ? src.Url.Trim() : "")// 
        .Map(dest => dest.Controller, src => src.Controller != null ? src.Controller.Trim() : "")// 控制器
        ;
    }
}